import { isSideBarGroup, isSideBarLink, SideBarItem } from "./catalogueconfig";
import { handlesidebarlink } from "./handlesidebarlink";

export function handlecatalogueconfig(
    rawcatalogue: SideBarItem[],
    menulist: string[],
    cachetitle: Map<string, string>,
    baseurl: string,
    catalogueurl: string
) {
    rawcatalogue.forEach((item) => {
        if (isSideBarLink(item)) {
            //转换成绝对地址
            handlesidebarlink(
                menulist,
                item,
                cachetitle,
                baseurl,
                catalogueurl
            );
            return;
        }
        if (isSideBarGroup(item)) {
            handlecatalogueconfig(
                item.children,
                menulist,
                cachetitle,
                baseurl,
                catalogueurl
            );
            return;
        }
        return;
    });
}
